#include "Logger.h"
#include "Timestamp.h"

#include <iostream>

Logger& Logger::instance() {
  static Logger logger;
  return logger;
}
void Logger::setLogLevel(const int level) {
  m_logLevel = level;
}
void Logger::log(const std::string& msg) {
  switch (m_logLevel) {
    case INFO:
      std::cout << "[INFO] ";
      break;
    case ERROR:
      std::cout << "[ERROR] ";
      break;
    case FATAL:
      std::cerr << "[FATAL] ";
      break;
    case DEBUG:
      std::cout << "[DEBUG] ";
    default:
      std::cout << "error level";
  }
  std::cout << Timestamp::now().toString() << " " << msg << std::endl;
}